from functools import reduce
def fn(x,y):
    return x * 10 + y
        
res = reduce(fn,[1,3,5,7,9])
print('res = ',res)

#累加
def add(x,y):
    return x + y
    
sum = reduce(add,[1,2,3,4])
print('sum=',sum)

#将map中的str转int
def char2num(s):
    digits = {'0':0,'1':1,'2':2,'3':3,'4':4,'5':5,'6':6,'7':7,'8':8,'9':9}
    return digits[s]

it = map(char2num,'13579')
L = list(it)
print('L=',L)
r = reduce(fn,L)
print('r=',r)